<template>
  <span>
    {{
      value === null || value === undefined
        ? '-'
        : format === 'date'
        ? dayjs(value).isValid()
          ? dayjs(value).format('YYYY-MM-DD')
          : '-'
        : `${value}${unit}`
    }}
  </span>
</template>

<script setup>
  import dayjs from 'dayjs'

  defineProps({
    // 业务id
    value: [String, Number],
    unit: {
      type: String,
      default: '',
    },
    format: String,
  })
</script>
